/*cixIeGzyj1cURQkA9LWhoSKSEnI3tWSTC1+3RvcjbciDARmlFf2ZZEJTO5Fzv8yp*/
package nccloud.web.workflow.approve.util;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Vector;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

import itf.approvecenter.util.DataExchangeBean;
import nc.bs.pf.pub.PfDataCache;
import nc.itf.pub.workflowqry.IFlowInstanceQuery;
import nc.itf.uap.pf.IPFWorkflowQry;
import nc.itf.uap.pf.IWorkflowDefine;
import nc.itf.uap.pf.metadata.IFlowBizItf;
import nc.jdbc.framework.exception.DbException;
import nc.md.data.access.NCObject;
import nc.message.vo.AttachmentVO;
import nc.uap.pf.metadata.PfMetadataTools;
import nc.vo.ml.NCLangRes4VoTransl;
import nc.vo.pub.AggregatedValueObject;
import nc.vo.pub.BusinessException;
import nc.vo.pub.checknote.PfChecknoteVO;
import nc.vo.pub.pf.AssignableInfo;
import nc.vo.pub.workflownote.WorkflownoteVO;
import nc.vo.uap.pf.PFRuntimeException;
import nc.vo.wfengine.core.activity.GenericActivityEx;
import nc.vo.wfengine.core.parser.XPDLParserException;
import nc.vo.wfengine.core.workflow.BasicWorkflowProcess;
import nc.vo.wfengine.core.workflow.WorkflowProcess;
import nc.vo.wfengine.definition.WorkflowTypeEnum;
import nc.vo.wfengine.pub.WFTask;
import nccloud.baseapp.core.log.NCCForUAPLogger;
import nccloud.commons.lang.StringUtils;
import nccloud.framework.core.exception.ExceptionUtils;
import nccloud.framework.mob.container.MobClientInfo;
import nccloud.framework.service.ServiceLocator;
import nccloud.framework.web.container.ClientInfo;
import nccloud.framework.web.container.SessionContext;
import nccloud.itf.uap.pf.NCCWorkFlowService;
import nccloud.message.itf.IApproveMessageQueryService;
import nccloud.pubitf.riart.pflow.CloudPFlowContext;
import nccloud.vo.pf.flowinstance.NCCFlowInstanceVO;
import nccloud.web.workflow.approvalcenter.action.PfChecknoteEnum;

public class NCCFlowUtils {

	/**
	 * 自定义审批语，支持多条 add by liangyub 2013-12-23
	 */
//	private static Map<Integer, String> customTxtNoteMap = null;

	private static class InstanceHolder {
		public static Map<Integer, String> customTxtNoteMap = new HashMap<Integer, String>();
	}

	public static Map<Integer, String> getInstance(String cuserid) {
		if (InstanceHolder.customTxtNoteMap == null || InstanceHolder.customTxtNoteMap.isEmpty()) {
			Map<Integer, PfChecknoteVO> type_checknote = NCCPfChecknoteCache.getInstance().getDefaultChecknote(cuserid);
			for (PfChecknoteVO vo : type_checknote.values()) {
				InstanceHolder.customTxtNoteMap.put(vo.getNotetype(), vo.getNote());
			}
		}

		return InstanceHolder.customTxtNoteMap; // 这里将导致InstanceHolder类被初始化
	}

	public static boolean isFlowParameterArrayNull(String[] parameterArray, Map<String, Object> msgInfoMap) {
		if (parameterArray != null && parameterArray.length > 0) {
			for (String parameter : parameterArray) {
				if (isFlowParameterNull(parameter, msgInfoMap)) {
					return true;
				}

			}
		}
		return false;
	}

	/**
	 * 验证流程获取参数
	 * 
	 * @param parameter
	 * @return
	 */
	public static boolean isFlowParameterNull(String parameter, Map<String, Object> msgInfoMap) {
		if (msgInfoMap.get(parameter) != null && StringUtils.isNotEmpty(msgInfoMap.get(parameter).toString())) {
			return false;
		} else {
			return true; 
		}
	}

	public static JSONObject exchangeDataMsg(DataExchangeBean bean, String code, String error) {
		bean.setCode(code);
		bean.setError(error);
		return (JSONObject) JSONObject.toJSON(bean);
	}

	/**
	 * 查找个性化中心设置的批语，如果未设置，则采用系统预置的。
	 *
	 * @param type 批语类型
	 * @return 批语 add by liangyub 2013-12-23
	 */
	public static String getIndividualCheckNote(PfChecknoteEnum type, String cuserid) {
		String note = getCustomTxtNoteMap(cuserid).get(type.toInt());
		if (!StringUtils.isEmpty(note)) {
			return note;
		}
		return type.toString();
	}

	public static String getIndividualCheckNote(PfChecknoteEnum type) {
		// mod by chenjma 移动适配用户
		ClientInfo info = SessionContext.getInstance().getClientInfo();
		MobClientInfo mobClientInfo = new MobClientInfo();
		String cuserid = info != null ? info.getUserid() : mobClientInfo.getUserid();
//		String cuserid = SessionContext.getInstance().getClientInfo().getUserid();
		return getIndividualCheckNote(type, cuserid);
	}

	// xuxwb 修改线程安全
	public static Map<Integer, String> getCustomTxtNoteMap(String cuserid) {
//		if (customTxtNoteMap == null||customTxtNoteMap.isEmpty()) {
//			 customTxtNoteMap =  new HashMap<Integer, String>();
//			Map<Integer, PfChecknoteVO> type_checknote = NCCPfChecknoteCache
//    				.getInstance().getDefaultChecknote(SessionContext.getInstance().getClientInfo().getUserid());
//    		for (PfChecknoteVO vo : type_checknote.values()) {
//    			customTxtNoteMap.put(vo.getNotetype(), vo.getNote());
//    		}
//
//		}
		return NCCFlowUtils.getInstance(cuserid);
	}

	public static void checkIsCopySend(WorkflownoteVO noteVo, JSONObject jsonObject) {

		List<String> copy_msg_users = null;
		List<String> copy_mail_users = null;
		if (jsonObject.get("copy_msg_users") != null
				&& StringUtils.isNotEmpty(jsonObject.getString("copy_msg_users"))) {
			copy_msg_users = (List<String>) jsonObject.get("copy_msg_users");

		}

		if (jsonObject.get("copy_mail_users") != null
				&& StringUtils.isNotEmpty(jsonObject.getString("copy_mail_users"))) {
			copy_mail_users = (List<String>) jsonObject.get("copy_mail_users");

		}

		if (copy_msg_users == null || copy_msg_users.size() == 0) {
			NCCForUAPLogger.debug("nothing");
		} else {
			noteVo.setMsgExtCpySenders(copy_msg_users);

		}

		if (copy_mail_users == null || copy_mail_users.size() == 0) {
			NCCForUAPLogger.debug("nothing");
		} else {
			noteVo.setMailExtCpySenders(copy_mail_users);
		}

	}

	/**
	 * 批准时，是否存在可指派的后继活动
	 *
	 * @return
	 */
	@SuppressWarnings("unchecked")
	public static boolean isExistAssignableInfoWhenPass(WorkflownoteVO worknoteVO) {

		if (worknoteVO.getActiontype().endsWith(WorkflownoteVO.WORKITEM_ADDAPPROVER_SUFFIX)) {
			return false;
		}

		Vector<AssignableInfo> assignInfos = worknoteVO.getTaskInfo().getAssignableInfos();
		if (assignInfos != null && assignInfos.size() > 0) {
			String strCriterion = null;
			for (AssignableInfo ai : assignInfos) {
				strCriterion = ai.getCheckResultCriterion();
				if (AssignableInfo.CRITERION_NOTGIVEN.equals(strCriterion)
						|| AssignableInfo.CRITERION_PASS.equals(strCriterion)) {
					return true;
				}
			}
		}
		return false;
	}

	/**
	 * 传入单据类型或者交易类型 加入工作流 判断Eng
	 * 
	 * @param transOrBiiType
	 * @param billVo
	 * @return
	 * @throws BusinessException
	 * @deprecated 作废 如果提交时判断是否有流程定义，请调用isHasStartFlow接口 如果收回时判断
	 *             请用isUnSaveBillInFlow接口
	 */
	@Deprecated
	public static boolean hasApproveflowDef(String transOrBiiType, AggregatedValueObject billVo)
			throws BusinessException {
		return hasApproveflowDef(transOrBiiType, billVo, SessionContext.getInstance().getClientInfo().getPk_group());
	}

	/**
	 * 传入单据类型或者交易类型 加入工作流 判断Eng
	 * 
	 * @param transOrBiiType
	 * @param billVo
	 * @return
	 * @throws BusinessException
	 * @deprecated 作废 如果提交时判断是否有流程定义，请调用isHasStartFlow接口 如果收回时判断
	 *             请用isUnSaveBillInFlow接口
	 */
	@Deprecated
	public static boolean hasApproveflowDef(String transOrBiiType, AggregatedValueObject billVo, String pk_group)
			throws BusinessException {
		IFlowBizItf fbi = PfMetadataTools.getBizItfImpl(billVo, IFlowBizItf.class);
		if (fbi == null) {
			throw new PFRuntimeException(NCLangRes4VoTransl.getNCLangRes().getStrByID("pfworkflow1",
					"PfUtilClient-000000")/* 元数据实体没有提供业务接口IFlowBizItf的实现类 */);
		}

		IWorkflowDefine wfDefine = ServiceLocator.find(IWorkflowDefine.class);
		NCCForUAPLogger.debug("查询流程定义: billType=" + transOrBiiType + ";pkOrg=" + fbi.getPkorg() + ";userId="
				+ fbi.getBillMaker() + ";开始");
		// 增加如果有在走流程 然而流程被停用，依然是可以查出来的为true
		NCObject ncObj = NCObject.newInstance(billVo);
		IFlowBizItf itf = ncObj.getBizInterface(IFlowBizItf.class);

		String billVersionPk = itf.getBillVersionPK();

		if (StringUtils.isBlank(billVersionPk)) {
			billVersionPk = billVo.getParentVO().getPrimaryKey();
		}

		boolean isStepIntoFlow = false;
		try {
			isStepIntoFlow = wfDefine.queryIsStepIntoFlow(billVersionPk, transOrBiiType, null);
		} catch (DbException e) {
			NCCForUAPLogger.error(e.getMessage(), e);
			// TODO Auto-generated catch block
			// e.printStackTrace();
		}

		if (isStepIntoFlow) {
			// 查询出是否是只有一个制单人的环节的情况
			NCCFlowInstanceVO[] resultInstance = ServiceLocator.find(IFlowInstanceQuery.class)
					.findFlowInstancesByBillIdAndBillTypeAppendOrderByCondition(billVersionPk, transOrBiiType);
			if (resultInstance != null && resultInstance.length > 0) {
				WorkflowProcess wf = null;
				try {
					wf = PfDataCache.getWorkflowProcess(resultInstance[0].getProcessdefid());
					if (wf.getState() != 1) {// 流程为1是运行中的
						isStepIntoFlow = false;
					}
				} catch (XPDLParserException e) {
					NCCForUAPLogger.error(e.getMessage(), e);
				} catch (BusinessException e) {
					NCCForUAPLogger.error(e.getMessage(), e);

				}
				// 活动环节为1即只有一个制单环节
				if (wf != null && wf.getActivities().size() == 1) {
					return false;
				}
			}

		}

		boolean hasApproveFlow = false;
		hasApproveFlow = wfDefine.hasValidProcessDef(pk_group, transOrBiiType, fbi.getPkorg(), fbi.getBillMaker(),
				fbi.getEmendEnum(), WorkflowTypeEnum.Approveflow.getIntValue());

		boolean hasWorkfFlow = false;

		hasWorkfFlow = wfDefine.hasValidProcessDef(pk_group, transOrBiiType, fbi.getPkorg(), fbi.getBillMaker(),
				fbi.getEmendEnum(), WorkflowTypeEnum.Workflow.getIntValue());

		return (isStepIntoFlow || hasApproveFlow || hasWorkfFlow);
	}

	/**
	 * 是否有流程，传入具体的枚举值即可查询 空的情况是判断是否进入了流程
	 * 
	 * @param transOrBiiType
	 * @param billVo
	 * @param flowEnum       @return`
	 * @deprecated 作废 如果提交时判断是否有流程定义，请调用isHasStartFlow接口 如果收回时判断
	 *             请用isUnSaveBillInFlow接口
	 * @throws BusinessException
	 */
	@Deprecated
	public static boolean hasflowDef(String transOrBiiType, AggregatedValueObject billVo, WorkflowTypeEnum flowEnum)
			throws BusinessException {
		return hasflowDef(transOrBiiType, billVo, flowEnum, SessionContext.getInstance().getClientInfo().getPk_group());

	}

	/**
	 * isUnSaveBillInFlow判断单据是否有可启用的流程 用于收回
	 * 
	 * @param transOrBiiType
	 * @param billVo
	 * @param pk_group
	 * @param flowType       2 审批流，4 工作流，0 不区分审批流工作流
	 * @return
	 * @throws BusinessException
	 */
	public static boolean isUnSaveBillInFlow(String transOrBiiType, AggregatedValueObject billVo, String pk_group,
			int flowType) throws BusinessException {

		if (WorkflowTypeEnum.Workflow.getIntValue() == flowType
				|| WorkflowTypeEnum.Approveflow.getIntValue() == flowType
				|| WorkflowTypeEnum.All.getIntValue() == flowType) {
			// 判断是否在流程中
			boolean isStepIntoFlow = false;
			IWorkflowDefine wfDefine = ServiceLocator.find(IWorkflowDefine.class);
			try {
				isStepIntoFlow = wfDefine.queryIsStepIntoFlow(billVo.getParentVO().getPrimaryKey(), transOrBiiType,
						null);
			} catch (DbException e) {
				throw new BusinessException(e);
			}
			if (isStepIntoFlow) {
				NCCFlowInstanceVO[] resultInstance = ServiceLocator.find(IFlowInstanceQuery.class)
						.findFlowInstancesByBillIdAndBillTypeAppendOrderByCondition(
								billVo.getParentVO().getPrimaryKey(), transOrBiiType);

				WorkflownoteVO[] notevos = ServiceLocator.find(IPFWorkflowQry.class)
						.queryWorkitems(billVo.getParentVO().getPrimaryKey(), transOrBiiType, 0, 0);

				if (resultInstance == null || resultInstance.length == 0) {
					return false;
				}
				// 活动环节为1即只有一个制单环节
				if (resultInstance.length == 1 && (notevos.length == 0 || notevos == null)) {
					return false;
				}

				WorkflowProcess wf = null;
				try {
					wf = PfDataCache.getWorkflowProcess(resultInstance[0].getProcessdefid());
				} catch (Exception e) {
					throw new BusinessException(e);
				}
				// 活动环节为1即只有一个制单环节
				if (wf != null && wf.getActivities().size() == 1) {
					return false;
				}
				return true;
			}

		} else {
			throw new PFRuntimeException("流程类型参数不正确");
		}
		// 没有走流程，按无流程走
		return false;
	}

	/**
	 * xuxwb 2021-3-21 判断是否有可启用的流程，用于单据的提交
	 * 
	 * @param billVo
	 * @param pk_group
	 * @param flowType 2 审批流，4 工作流，0 不区分审批流工作流
	 * @return
	 */
	public static boolean isHasStartFlow(String transOrBiiType, AggregatedValueObject billVo, String pk_group,
			int flowType) {

		try {
			IFlowBizItf fbi = PfMetadataTools.getBizItfImpl(billVo, IFlowBizItf.class);
			if (fbi == null) {
				throw new PFRuntimeException(NCLangRes4VoTransl.getNCLangRes().getStrByID("pfworkflow1",
						"PfUtilClient-000000")/* 元数据实体没有提供业务接口IFlowBizItf的实现类 */);
			}

			IWorkflowDefine wfDefine = ServiceLocator.find(IWorkflowDefine.class);
			WorkflowTypeEnum flowtype = WorkflowTypeEnum.fromIntValue(flowType);
			switch (flowtype) {
			case All:
				boolean approveflow = wfDefine.hasValidProcessDef(pk_group, transOrBiiType, fbi.getPkorg(),
						fbi.getBillMaker(), fbi.getEmendEnum(), WorkflowTypeEnum.Approveflow.getIntValue());

				boolean workflow = wfDefine.hasValidProcessDef(pk_group, transOrBiiType, fbi.getPkorg(),
						fbi.getBillMaker(), fbi.getEmendEnum(), WorkflowTypeEnum.Workflow.getIntValue());
				return approveflow || workflow;
			case Approveflow:
				return wfDefine.hasValidProcessDef(pk_group, transOrBiiType, fbi.getPkorg(), fbi.getBillMaker(),
						fbi.getEmendEnum(), WorkflowTypeEnum.Approveflow.getIntValue());
			case Workflow:
				return wfDefine.hasValidProcessDef(pk_group, transOrBiiType, fbi.getPkorg(), fbi.getBillMaker(),
						fbi.getEmendEnum(), WorkflowTypeEnum.Workflow.getIntValue());
			default:
				throw new PFRuntimeException("流程类型参数不正确");

			}

		} catch (Exception e) {
			throw new PFRuntimeException(e.getMessage(), e);
		}

	}

	/**
	 * 
	 * @param transOrBiiType
	 * @param billVo
	 * @param flowEnum
	 * @param pk_group
	 * @return
	 * @throws BusinessException
	 * @deprecated 作废 如果提交时判断是否有流程定义，请调用isHasStartFlow接口.
	 */
	@Deprecated
	public static boolean hasflowDef(String transOrBiiType, AggregatedValueObject billVo, WorkflowTypeEnum flowEnum,
			String pk_group) throws BusinessException {
		IFlowBizItf fbi = PfMetadataTools.getBizItfImpl(billVo, IFlowBizItf.class);
		if (fbi == null) {
			throw new PFRuntimeException(NCLangRes4VoTransl.getNCLangRes().getStrByID("pfworkflow1",
					"PfUtilClient-000000")/* 元数据实体没有提供业务接口IFlowBizItf的实现类 */);
		}

		IWorkflowDefine wfDefine = ServiceLocator.find(IWorkflowDefine.class);
		NCCForUAPLogger.debug("查询流程定义: billType=" + transOrBiiType + ";pkOrg=" + fbi.getPkorg() + ";userId="
				+ fbi.getBillMaker() + ";开始");
		// 增加如果有在走流程 然而流程被停用，依然是可以查出来的为true

		boolean isStepIntoFlow = false;

		if (flowEnum == null) {
			try {
				isStepIntoFlow = wfDefine.queryIsStepIntoFlow(billVo.getParentVO().getPrimaryKey(), transOrBiiType,
						null);
			} catch (DbException e) {
				NCCForUAPLogger.error(e.getMessage(), e);
				// TODO Auto-generated catch block
				// e.printStackTrace();
			}

			return isStepIntoFlow;
		}

		// 增加了制单人唯一环节的判断
		try {
			isStepIntoFlow = wfDefine.queryIsStepIntoFlow(billVo.getParentVO().getPrimaryKey(), transOrBiiType, null);
		} catch (DbException e) {
			NCCForUAPLogger.error(e.getMessage(), e);
			// TODO Auto-generated catch block
			// e.printStackTrace();
		}

		if (isStepIntoFlow) {

			// 查询出是否是只有一个制单人的环节的情况
			NCCFlowInstanceVO[] resultInstance = ServiceLocator.find(IFlowInstanceQuery.class)
					.findFlowInstancesByBillIdAndBillTypeAppendOrderByCondition(billVo.getParentVO().getPrimaryKey(),
							transOrBiiType);
			WorkflowProcess wf = null;
			try {
				wf = PfDataCache.getWorkflowProcess(resultInstance[0].getProcessdefid());

			} catch (XPDLParserException e) {
				NCCForUAPLogger.error(e.getMessage(), e);
			} catch (BusinessException e) {
				NCCForUAPLogger.error(e.getMessage(), e);

			}

			WorkflownoteVO[] notevos = ServiceLocator.find(IPFWorkflowQry.class)
					.queryWorkitems(billVo.getParentVO().getPrimaryKey(), transOrBiiType, 0, 0);

			if (resultInstance.length == 1 && (notevos.length == 0 || notevos == null)) {
				return false;
			}

			// 活动环节为1即只有一个制单环节
			if (wf != null && wf.getActivities().size() == 1) {
				return false;
			}

		}

		boolean hasFlow = false;
		if (flowEnum.getIntValue() == WorkflowTypeEnum.Approveflow.getIntValue()
				|| flowEnum.getIntValue() == WorkflowTypeEnum.SubApproveflow.getIntValue()) {
			hasFlow = wfDefine.hasValidProcessDef(pk_group, transOrBiiType, fbi.getPkorg(), fbi.getBillMaker(),
					fbi.getEmendEnum(), WorkflowTypeEnum.Approveflow.getIntValue());
			if (hasFlow) {
				return hasFlow;
			}

		} else {
			hasFlow = wfDefine.hasValidProcessDef(pk_group, transOrBiiType, fbi.getPkorg(), fbi.getBillMaker(),
					fbi.getEmendEnum(), WorkflowTypeEnum.Workflow.getIntValue());

			if (hasFlow) {
				return hasFlow;
			}
		}

		return hasFlow;

	}

	public static boolean isCanTransfer(WFTask task) throws BusinessException {
		try {
			BasicWorkflowProcess wf = PfDataCache.getWorkflowProcess(task.getWfProcessDefPK(),
					task.getWfProcessInstancePK());
			return ((GenericActivityEx) wf.findActivityByID(task.getActivityID())).getCanTransfer();
		} catch (XPDLParserException e) {
			NCCForUAPLogger.error(e.getMessage(), e);
			throw new BusinessException(e);
		}

	}

	public static WorkflownoteVO getCheckWorkflowNote(String workflow_type, String billTypeOrTransType,
			AggregatedValueObject billvo) {
		CloudPFlowContext context = new CloudPFlowContext();
		String actionName = "";
		WorkflownoteVO note = null;
		if (StringUtils.isNotEmpty(workflow_type)) {
			int flowtype = Integer.valueOf(workflow_type).intValue();
			if (flowtype == 2 || flowtype == 3) {
				actionName = "APPROVE";
			} else {
				actionName = "SIGNAL";
			}

			context.setActionName(actionName);
			context.setBillType(billTypeOrTransType);
			context.setBillVos(new AggregatedValueObject[] { billvo });
			context.seteParam(new HashMap<Object, Object>());
			NCCWorkFlowService nccWorkFlowService = ServiceLocator.find(NCCWorkFlowService.class);
			try {
				note = nccWorkFlowService.checkWorkflow(context);
			} catch (BusinessException e) {
				NCCForUAPLogger.error(e.getMessage(), e);
				ExceptionUtils.wrapException(e);
			}

		}
		return note;
	}

	public static void checkIsExistMessage(String billtype, String billid, String cuserid) {

		JSONObject params = new JSONObject();
		IApproveMessageQueryService iMessageQueryService = ServiceLocator.find(IApproveMessageQueryService.class);
		params.put("billid", billid);
		params.put("billtype", billtype);
		params.put("userId", cuserid);

		List<JSONObject> msgs = null;
		try {
			msgs = iMessageQueryService.queryNCMessages(params);
		} catch (BusinessException e) {
			NCCForUAPLogger.error(e.getMessage(), e);
			ExceptionUtils.wrapException(e);
		}

		if (msgs == null || msgs.size() == 0) {
			ExceptionUtils.wrapBusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("0020nccloud_0",
					"0ncc0020001-0453")/* @res 业务数据异常，请刷新重试 */);
		}

	}

	public static void checkIsExistMessage(String billtype, String billid) {
		// mod by chenjma 移动适配用户
		ClientInfo info = SessionContext.getInstance().getClientInfo();
		MobClientInfo mobClientInfo = new MobClientInfo();
		String cuserid = info != null ? info.getUserid() : mobClientInfo.getUserid();
		
		checkIsExistMessage(billtype, billid, cuserid);
	}

	public static void handleAttrfiles(JSONObject json2, WorkflownoteVO note) {

		if (json2.get("attrfiles") != null) {

			List<Object> attrfiles = (List<Object>) json2.get("attrfiles");

			JSONArray attrfilesAray = new JSONArray(attrfiles);
//
//		for(Object json :attrfilesAray ){
//
//			JSONObject json1 = new JSONObject(json);
//
//		}
			List<AttachmentVO> atttfiles = new ArrayList<AttachmentVO>();
			for (int i = 0; i < attrfilesAray.size(); i++) {
				JSONObject job = attrfilesAray.getJSONObject(i);
				AttachmentVO attvo = new AttachmentVO();
				attvo.setPk_file(job.getString("pk_file"));
				attvo.setFilesize(job.getInteger("filesize"));
				attvo.setFilename(job.getString("name"));
				atttfiles.add(attvo);
			}
			note.setAttachmentSetting(atttfiles);
		}
	}

}
/* cixIeGzyj1cURQkA9LWhoSKSEnI3tWSTC1+3RvcjbciDARmlFf2ZZEJTO5Fzv8yp */
